using System;
using System.Net.DnsToolkit.Packet.Records;

namespace System.Net.DnsToolkit.Packet.Busy.Records
{
    /*
    3.3.9. MX RDATA format

        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        |                  PREFERENCE                   |
        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        /                   EXCHANGE                    /
        /                                               /
        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

    where:

    PREFERENCE      A 16 bit integer which specifies the preference given to
                    this RR among others at the same owner.  Lower values
                    are preferred.

    EXCHANGE        A <domain-name> which specifies a host willing to act as
                    a mail exchange for the owner name.

    MX records cause type A additional section processing for the host
    specified by EXCHANGE.  The use of MX RRs is explained in detail in
    [RFC-974].
    */
    public class RecordMX : IRecord, IRecordMX
	{
        public ushort PREFERENCE { get; set; }
        public IDomainName EXCHANGE { get; set; }

        public QTypeEnum QType {
            get {
                return QTypeEnum.MX;
            }
        }

        public override string ToString()
		{
			return string.Format("{0} {1}", 
                PREFERENCE, 
                EXCHANGE == null ? string.Empty : EXCHANGE.ToString());
		}


	}
}
